package com.miracle.java2110.common;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@AllArgsConstructor
@NoArgsConstructor
public class R {
    private Integer code;

    private String msg;

    private Object result;

    public static R ok(Integer code,String msg,Object content) {return new R(code,msg,content);}

    public static R ok(Integer code,String msg) {return new R(code,msg);}

    public static R ok(Integer code) {return new R(code, "操作成功");}

    public static R fail(String msg) {return new R(400,msg);}

    public static R error(Integer code, String msg) {
        return new R(code, msg);

    }

    public R(Integer code, String msg) {
        this.code = code;
        this.msg = msg;
    }

}
